package com.xly.component;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.xly.service.UserInfoService;

//@Component 启用该注解，任务计划就会运行
@EnableScheduling
public class ScheduledTask {

	@Autowired
	private UserInfoService userInfoService;
	
	@Scheduled(cron="0/10 * * * * ?")
	public void scheduled1() {
		System.out.println("scheduled1 is working");
		System.out.println(userInfoService);
	}
}
